function [] = VisualState(S, num_players_r, num_players_b)

    B = S{1};
    
    for i = 2:(1+num_players_r),
        T1(i-1,:) = S{i};
    end    
    
    for i = (2+num_players_r):numel(S)
        T2(i-(1+num_players_r),:) = S{i};
    end
        
    height = 60;
    width = 120;

    scrsz = get(0,'ScreenSize');%scrsz(4)/2
    f=figure('Position',[0 scrsz(4)-height*10 width*10 height*10],'Name','Soccer simulation window','NumberTitle','off');
    %set(f,'CloseRequestFcn',@figclosereq);
    set(gca,'Color',[0 0.7 0.3]);
    axis equal
    
    figure(f);
    f=plotGrid(f);
    f=plotPlayers(T1,f);
    f=plotPlayers(T2,f);
    plotBall(B);
    drawnow;

    StateToText(S, num_players_r, num_players_b)
    
    %SaveAllFigures('plots/SOM/','State','png');
end

%Ball plotting procedure%
function plotBall(B)
global ball_size ;
B_X=B{1}(1);
B_Y=B{1}(2);
%B_VX=B{2}(1);
%B_VY=B{2}(2);
hold on
plot(B_X,B_Y,'o', 'MarkerSize',ball_size,'MarkerFaceColor',[1 1 1]);
plot(B_X,B_Y,'*', 'MarkerSize',ball_size/2,'MarkerFaceColor',[0 0 0]);
hold off;
drawnow
end